package com.cbs.android.component.toast;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

/**
 * Created by broche on 10/25/16.
 */

public class ToastConfig {
    private String content = "";
    private int duration = Toast.LENGTH_SHORT;
    private View view = null;
    private Integer gravity = null;
    private Integer offsetX = null;
    private Integer offsetY = null;
    private Float marginHorizental = null;
    private Float marginVertical = null;

    public ToastConfig setContent(String content) {
        this.content = content;
        return this;
    }

    public ToastConfig setDuration(int duration) {
        this.duration = duration;
        return this;
    }

    public ToastConfig setView(View view) {
        this.view = view;
        return this;
    }

    public ToastConfig setView(Context context, int layout) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(layout, null, false);
        setView(view);
        return this;
    }

    public ToastConfig setGravity(int gravity, int offsetX, int offsetY) {
        this.gravity = gravity;
        this.offsetX = offsetX;
        this.offsetY = offsetY;
        return this;
    }

    public ToastConfig setMargin(float marginHorizental, float marginVertical) {
        this.marginHorizental = marginHorizental;
        this.marginVertical = marginVertical;
        return this;
    }

    public String getContent() {
        return content;
    }

    public int getDuration() {
        return duration;
    }

    public View getView() {
        return view;
    }

    public Integer getGravity() {
        return gravity;
    }

    public Integer getOffsetX() {
        return offsetX;
    }

    public Integer getOffsetY() {
        return offsetY;
    }

    public Float getMarginHorizental() {
        return marginHorizental;
    }

    public Float getMarginVertical() {
        return marginVertical;
    }
}
